/**
 * 
 */
package org.lookouster.nextAgadir.pointageBureau.bases;

import java.sql.SQLException;

import org.lookouster.nextAgadir.pointageBureau.dbDESC.REMA;
import org.lookouster.nextAgadir.pointageBureau.dbDESC.Tables;
import org.lookouster.nextAgadir.pointageBureau.outils.BDConnect;

/**
 * @author Lookouster
 *
 */
public class Remarque {

	/*
 * (non-javadoc)
 */
	private int idRemarque;
private Ouvrier ouvrier = null;
private boolean position, presence;
 
/**
 * Getter of the property <tt>ouvrier</tt>
 *
 * @return Returns the ouvrier.
 * 
 */
public Ouvrier getOuvrier()
{
	return ouvrier;
}

/**
 * Setter of the property <tt>ouvrier</tt>
 *
 * @param ouvrier The ouvrier to set.
 *
 */
public void setOuvrier(Ouvrier ouvrier ){
	this.ouvrier = ouvrier;
}

/*
 * (non-javadoc)
 */
private EspaceTravail espaceTravail = null;
 
/**
 * Getter of the property <tt>espaceTravail</tt>
 *
 * @return Returns the espaceTravail.
 * 
 */
public EspaceTravail getEspaceTravail()
{
	return espaceTravail;
}

/**
 * Setter of the property <tt>espaceTravail</tt>
 *
 * @param espaceTravail The espaceTravail to set.
 *
 */
public void setEspaceTravail(EspaceTravail espaceTravail ){
	this.espaceTravail = espaceTravail;
}

/*
 * (non-javadoc)
 */
private Controle controle = null;
 
/**
 * Getter of the property <tt>controle</tt>
 *
 * @return Returns the controle.
 * 
 */
public Controle getControle()
{
	return controle;
}

/**
 * @param ouvrier
 * @param position
 * @param presence
 * @param espaceTravail
 * @param controle
 */
public Remarque(Ouvrier ouvrier, boolean presence, boolean position,
		EspaceTravail espaceTravail, int idControle) {
	super();
	this.ouvrier = ouvrier;
	this.position = position;
	this.presence = presence;
	this.espaceTravail = espaceTravail;
	controle=new Controle();
	this.controle.setIdControle(idControle);
}

/**
 * Setter of the property <tt>controle</tt>
 *
 * @param controle The controle to set.
 *
 */
public void setControle(Controle controle ){
	this.controle = controle;
}


public void saveDB(BDConnect bdc)
{
	String sql="insert into "+Tables.DB_TABLE_REMA+"("+REMA.CHP_ID_OUVR+", "+
	REMA.CHP_ID_ESP+", "+REMA.CHP_ID_CTL+", "+REMA.CHP_PRES+", "+REMA.CHP_POS+
	") values("+this.getOuvrier().getIdEmploye()+","+
	this.getEspaceTravail().getIdEspaceTravail()+","+
	this.getControle().getIdControle()+", "+presence+", "+position+")";
	try {
		bdc.update(sql);
	} catch (SQLException e) {
		// TODO Auto-generated catch block
		//e.printStackTrace();
		System.out.println("Echec insertion remarque!! "+e.getMessage());
	}
	
	
}

/**
 * @return the idRemarque
 */
public int getIdRemarque() {
	return idRemarque;
}

/**
 * @param idRemarque the idRemarque to set
 */
public void setIdRemarque(int idRemarque) {
	this.idRemarque = idRemarque;
}

/**
 * @return the position
 */
public boolean getPosition() {
	return position;
}

/**
 * @param position the position to set
 */
public void setPosition(boolean position) {
	this.position = position;
}

/**
 * @return the presence
 */
public boolean getPresence() {
	return presence;
}

/**
 * @param presence the presence to set
 */
public void setPresence(boolean presence) {
	this.presence = presence;
}
	

}
